package indi.zhifa.study2025.oa.admin.controller;

import indi.zhifa.engine.core.common.web.ann.ZhiFaRestController;
import indi.zhifa.study2025.oa.admin.facade.user.IUserFacade;
import indi.zhifa.study2025.oa.common.util.ConstantUtil;
import indi.zhifa.study2025.oa.model.expose.user.dto.CreateUserDto;
import indi.zhifa.study2025.oa.model.expose.user.vo.CreateUserVo;
import indi.zhifa.study2025.oa.model.expose.user.vo.UserInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Validated
@RequiredArgsConstructor
@Tag(name = "用户接口")
@ZhiFaRestController
@RequestMapping(ConstantUtil.API_PREFIX + "/user")
public class UserController {

    final IUserFacade mUserFacade;

    @Operation(summary = "创建用户")
    @PostMapping
    public CreateUserVo createUser(@RequestBody CreateUserDto pCreateUserDto) {
        CreateUserVo rtn =  mUserFacade.createUser(pCreateUserDto);
        return rtn;
    }

    @Operation(summary = "查看用户")
    @GetMapping("/{id}")
    public UserInfo getUserInfo(@PathVariable(name = "id") Long pUserId) {
        return mUserFacade.info(pUserId);
    }


}
